# -*- coding: utf-8 -*-
import sys
sys.path.append('../Lib/')
from Load_Lib import *

def run_ARCH(path_file):
    workdir="./example/test_input"
    ARCH_bin = os.path.join(workdir, 'bin', 'ARCH')
    result = subprocess.run([ARCH_bin, path_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)   #subprocess.PIPE一个可以被用于Popen的stdin 、stdout 和stderr 3个参数的特输值，表示需要创建一个新的管道。  [ARCH_bin, path_file]:描述的命令；stdout=subprocess.PIPE：标准输出； stderr=：标准错误文件句柄


if __name__ == '__main__':

	work="general"
	#work="mh_mch_20"
	target_folder = "./control/control_scan_4b0j_{}".format(work)
	filelength=len(Find_File(target_folder, "file"))
	file_general_name = "path_{}.dat"

	file_name_list=Generate_General_NameList(file_general_name,target_folder,filelength)   #file_general_name拼接到target_folder后，生成文件列表，共filelength个
	
	Parallel_Running(run_ARCH, file_name_list)
